<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Category extends Model
{
    use HasFactory,SoftDeletes;
    protected $dateFormat='U';
    protected $guarded=[];
    protected $table='category';

    public function child()
    {
        return $this->hasMany(Category::class,'pid','id');
    }

    public function products()
    {
        return $this->hasMany(Products::class,'category_id','id');
    }
}
